package HomeWork;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @description:
 * @Author yyp
 * @time 2022/3/25
 */
public class HomeWork01 {
    public static void main(String[] args) {
        newspaper paper1 = new newspaper("新冠肺炎确诊超过两千万，数百万印度教徒仍然前往恒河沐浴");
        newspaper paper2 = new newspaper("男子突然想起两个月前钓的鱼还在兜里，捞起来一看赶紧放生");
        List<newspaper> list= new ArrayList<>();
        list.add(paper1);
        list.add(paper2);
        Collections.reverse(list);
        for (newspaper newspaper : list) {
            if(newspaper.title.length()>15){
                System.out.println(newspaper.title.substring(0,15)+"……");
            }
        }
    }
}

class newspaper{
    String title;
    String in;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getIn() {
        return in;
    }

    public void setIn(String in) {
        this.in = in;
    }

    @Override
    public String toString() {
        return "HomeWork.newspaper{" +
                "title='" + title + '\'' +
                '}';
    }

    public newspaper(String title) {
        this.title = title;
    }
}

